package cn.kgc.disk.service;

import cn.kgc.disk.Dao.Disk;
import cn.kgc.disk.Dao.UserDao;
import cn.kgc.disk.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("beanService")
public class BeanService implements BeanInter {

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
//@Autowired//按照类型装配
//@Qualifier("userDao")//按照id装配
    @Resource(name = "userDao")
    private UserDao userDao;
    private String s1;

    public void setS1(String s1) {
        this.s1 = s1;
    }

    public void setS2(String s2) {
        this.s2 = s2;
    }

    public void setI1(int i1) {
        this.i1 = i1;
    }

    private String s2;
    private int i1;

    public BeanService(UserDao userDao, String s1) {
        this.userDao = userDao;
        this.s1 = s1;
    }
    public BeanService(UserDao userDao, int i1) {
        this.userDao = userDao;
        this.s1 = s1;
    }
    public BeanService(String s2,UserDao userDao) {
        this.userDao = userDao;
        this.s2 = s2;
    }



    public BeanService(UserDao userDao) {
        this.userDao = userDao;
    }

    public BeanService() {
    }


    @Override
    public void addNewUser(User user) {
//        System.out.println("s1"+s1);
//        System.out.println("s2"+s2);
//        System.out.println(i1);
        userDao.save(user);
    }
}
